/mnt/md1200/6/yjp/5hmc_analysis_hg19_new/20201207
###LIBD 的eQTL数据

library(data.table)
gwas1=fread("BrainSeqPhaseII_eQTL_FDR1perc_DLPFC_exon.txt",head=T,sep="\t")
gwas2=fread("BrainSeqPhaseII_eQTL_FDR1perc_DLPFC_gene.txt",head=T,sep="\t")
gwas3=fread("BrainSeqPhaseII_eQTL_FDR1perc_DLPFC_jxn.txt",head=T,sep="\t")
gwas4=fread("BrainSeqPhaseII_eQTL_FDR1perc_DLPFC_tx.txt",head=T,sep="\t")
gwas5=fread("BrainSeqPhaseII_eQTL_FDR1perc_HIPPO_jxn.txt",head=T,sep="\t")
gwas6=fread("BrainSeqPhaseII_eQTL_FDR1perc_HIPPO_exon.txt",head=T,sep="\t")
gwas7=fread("BrainSeqPhaseII_eQTL_FDR1perc_HIPPO_gene.txt",head=T,sep="\t")
gwas8=fread("BrainSeqPhaseII_eQTL_FDR1perc_HIPPO_tx.txt",head=T,sep="\t")

gwas1=dplyr::select(gwas1,snp,feature_id,Symbol,EnsemblGeneID)
gwas2=dplyr::select(gwas2,snp,feature_id,Symbol,EnsemblGeneID)
gwas3=dplyr::select(gwas3,snp,feature_id,Symbol,EnsemblGeneID)
gwas4=dplyr::select(gwas4,snp,feature_id,Symbol,EnsemblGeneID)
gwas5=dplyr::select(gwas5,snp,feature_id,Symbol,EnsemblGeneID)
gwas6=dplyr::select(gwas6,snp,feature_id,Symbol,EnsemblGeneID)
gwas7=dplyr::select(gwas7,snp,feature_id,Symbol,EnsemblGeneID)
gwas8=dplyr::select(gwas8,snp,feature_id,Symbol,EnsemblGeneID)
gwas1$gwas.group.source="exon"
gwas2$gwas.group.source="gene"
gwas3$gwas.group.source="junction"
gwas4$gwas.group.source="transcription"
gwas5$gwas.group.source="junction"
gwas6$gwas.group.source="exon"
gwas7$gwas.group.source="gene"
gwas8$gwas.group.source="transcription"
gwas=rbind(gwas1,gwas2,gwas3,gwas4,gwas5,gwas6,gwas7,gwas8)
gwas1=tidyr::separate(gwas,snp,into=c("snp","pos","Ref","Alt"),sep=":")
file=fread("200ASH.add.eQTL.GWAS.csv",head=T,sep=",")
snp=unique(as.character(file$avsnp150))
tmp=gwas1[gwas1$snp %in% snp,]

rt =gwas1[1,]
rt=rt[-1,]
for(i in 1:200){
j=snp[i]
tmp=gwas1[gwas1$snp==j,]
rt=rbind(rt,tmp)
}